<template>
  <div class="stu-notice">
    <div>
      <span class="titleSty">审阅状况</span>
    </div>
    <div class="stuCheckList">
      <el-table
          :data="tableData"
          style="width: 100%;"
          height="12rem">
          <el-table-column type="expand">
            <template slot-scope="props">
              <el-form label-position="left" inline class="demo-table-expand">
                <el-form-item label="内容：">
                  <span>{{ props.row.content }}</span>
                </el-form-item>
              </el-form>
            </template>
          </el-table-column>
          <el-table-column
          label="日期"
          sortable
          prop="update_date">
          </el-table-column>
          <el-table-column
          label="科目"
          sortable
          prop="subject_name">
          </el-table-column>
          <el-table-column
          label="状态"
          sortable
          prop="checkStatus">
          </el-table-column>
          <!-- <el-table-column
          align="center"
          prop="resTime">
          </el-table-column> -->
      </el-table>
    </div>
  </div>
</template>

<script>
import http from '../../../util/http';

export default {
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    getCheckList() {
      http.get(`/questionAPI/getListByStudentId?stu_id=${window.localStorage.getItem('userId')}`)
      .then((res) => {
        this.tableData = res.resultMap.stuList;
        this.listLength = res.resultMap.stuList.length;
        // console.log(this.listLength);
        // console.log(this.tableData);
        for (let i = 0; i < this.listLength; i += 1) {
          if (this.tableData[i].check_flag === 1) {
            this.tableData[i].checkStatus = '审阅通过';
          } else if (this.tableData[i].check_flag === 0) {
            this.tableData[i].checkStatus = '待审阅';
          }
        }
      })
      .catch((error) => {
        // console.log(error);
      });
    },
  },
  mounted() {
    this.getCheckList();
  },

};
</script>
<style scoped>
.stu-notice{
  margin: 0 0 0 2.5rem;
  width: 13rem;
}
.titleSty{
  color: white;
  font-size: .7rem;
  margin: 0 0 0 .5rem;
}
.stuCheckList{
  margin-top: .5rem;
  box-shadow:.1rem .06rem .15rem #888;
}
.demo-table-expand .el-form-item {
  margin: auto;
  width: 90%;
}
</style>
